{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Logistic Regression (MNIST)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "We are going to use the MNIST dataset because it is for people who want to try learning techniques and pattern recognition methods on real-world data while spending minimal efforts on preprocessing and formatting. One of the things we will notice is that parameter tuning can greatly speed up and improve a machine learning algorithm. "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Downloading the Data (MNIST)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 46,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "%matplotlib inline\n",
    "from sklearn.datasets import fetch_mldata\n",
    "# Change data_home to wherever to where you want to download your data\n",
    "mnist = fetch_mldata('MNIST original')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Now that you have the dataset loaded you can use the commands below"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 47,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "('Image Data Shape', (70000, 784))\n",
      "('Label Data Shape', (70000,))\n"
     ]
    }
   ],
   "source": [
    "# Print to show there are 1797 images (8 by 8 images for a dimensionality of 64)\n",
    "print(\"Image Data Shape\" , mnist.data.shape)\n",
    "\n",
    "# Print to show there are 1797 labels (integers from 0-9)\n",
    "print(\"Label Data Shape\", mnist.target.shape)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Splitting Data into Training and Test Sets (MNIST)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 48,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "from sklearn.model_selection import train_test_split\n",
    "train_img, test_img, train_lbl, test_lbl = train_test_split(\n",
    "    mnist.data, mnist.target, test_size=1/7.0, random_state=0)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 49,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(60000, 784)\n"
     ]
    }
   ],
   "source": [
    "print(train_img.shape)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 50,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(60000,)\n"
     ]
    }
   ],
   "source": [
    "print(train_lbl.shape)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 51,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(10000, 784)\n"
     ]
    }
   ],
   "source": [
    "print(test_img.shape)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 52,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(10000,)\n"
     ]
    }
   ],
   "source": [
    "print(test_lbl.shape)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Showing the Images and Labels (MNIST)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 53,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAABIEAAAEKCAYAAACFeUV9AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3XuUZWV5L+rfxzXQiIIKAUQRL0G3F1C2Ow6J4kEU0GwV\nFYLKVkHwGI1KwvEaonGboaIQiRciOXLzLgJKBI2IuvGuDVFRQQMKAiKIQABBONLf+aNWh6ZZ3+qq\nVavWmt3zecaoUdXzrfXNt9fgR61+a675lVprAAAAAFi3rTfrBgAAAABYeoZAAAAAAD1gCAQAAADQ\nA4ZAAAAAAD1gCAQAAADQA4ZAAAAAAD1gCNRhpZTNSim1lPK5Cay1vJRy8yT6gr6TTegm2YRukk3o\nJtnsJ0OgIQZBWMjHi2fd87qulLKslHLx4Pm+aNb9MBuyOXullAeWUo4opZxaSvn5Ks/1H8+6N2ZH\nNruhlLJtKeU9pZQfl1JuLqX8ppTyvVLKq0spm866P6ZPNrvH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Pf/G6ATZvNP2228/8TVPOeWUia85\njm233Xbia3bl77auks3Fe+1rX9us3e9+92vWrr766mbt61//+oL7+MEPftCsvepVr1rwekly9tln\nN2snnHDCWGtutdVWYz1uXbHGIVCt9YBGafKTAWDeZBO6STahm2QTukk2YbrGfTsYAAAAAGsRQyAA\nAACAHjAEAgAAAOgBQyAAAACAHjAEAgAAAOiBNe4O1jejtnrfb7/xdib8xS9+0aztv//+zdpll102\n1vnGseWWWzZrT3ziEyd+vre//e0TXxPWRfe6171m3QKM7be//W2zNmr7+B122KFZ+/SnP92sjfoZ\n/qAHPahZO+aYY4Yev/LKK5uPga7bdNNNm7UHP/jBY625fPnyZu28884ba81J23nnnSe+5hve8IZm\n7eCDD27WvvWtbzVrl19++Vi9fOITnxh6/NZbbx1rPbplvfXa12gcffTRzdqLX/zisc73rne9a6zH\nTdOobezHdccdd0x8zbWJK4EAAAAAesAQCAAAAKAHDIEAAAAAesAQCAAAAKAHDIEAAAAAesAQCAAA\nAKAHSq11eicrZXonG+E+97lPs/bFL36xWXv0ox891vme/exnN2tnnHHGWGuOsmzZsqHHH/awhzUf\n84xnPKNZO+KIIxbd0+qe/vSnN2vf+c53mrXrr79+4r1MU621zLqHYbqSzXXBy172smbt2GOPXfB6\nN9xwQ7O25ZZbLng9hpPNtcdjHvOYZu0d73hHs/aUpzxlKdpZsJ/+9KfN2qif030lm+PbZpttmrVx\ntyf/+c9/3qztvvvuzdqTnvSkZm3U6/KWxz/+8c3a/vvv36xN8989S2W77bYbenwpttEeRTaXxjvf\n+c5m7fDDDx9rzSuuuKJZe8ADHjDWmtP01re+tVl705ve1Kz94Q9/aNae9rSnNWtf/epX59VXV80n\nm64EAgAAAOgBQyAAAACAHjAEAgAAAOgBQyAAAACAHjAEAgAAAOiBDWbdwCzss88+zdq4O4CNssce\nezRr973vfcda8xGPeESz9tSnPnXo8Z122mmscy2FM888s1kbtfPE+9///mbtPe95z6J6gkn49re/\n3az97ne/G3p8s802az5m4403XnRPsC45//zz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dVbV1r\nvWrw9a+TbD3DXv6qlPLDweV7U7lUcKVSyg5Jdknyncz4OVmtl2SGz8sUyGabbKY72exZLhPZHEU2\nI5szJJttshnZnJEu5TLpVja7lMtENmeWzb7fGHq3WuvOSfZO8orBpWqdUOfepzfd9+rd6dgkOybZ\nOclVSY6a1olLKZslOTXJa2qtN65am/ZzMqSXmT0vPSSbw/U+m3I5c7I5nGzK5qzJ5nCyKZuz1sls\nzjiXiWzONJuzGAJdmWT7Vf58v8Gxqau1Xjn4fE2S0zN3+eAsXT14j+DK9wpeM4smaq1X11rvqLWu\nSPIvmdLzUkrZMHNB+Git9bTB4Zk8J8N6mdXzMkWy2SabHchmT3OZyOYosimbsySbbbIpm7PSmVwm\nnctmJ3KZyOasszmLIdD3kjyklPLAUspGSf4iyRnTbqKUsmxwI6aUUpYleWqSH41+1JI7I8mLBl+/\nKMlnZ9HEyhAMPDtTeF5KKSXJh5JcWGs9epXS1J+TVi+zeF6mTDbbZHPG2exxLhPZHEU2ZXOWZLNN\nNmVzVjqRy6ST2exELhPZHNbHVJ+TWuvUP5Lsk7m7tl+S5E0z6mHHJD8YfPx42n0k+XjmLvP6/zL3\nXtWDk9w7yTlJ/iPJl5JsOaM+PpzkgiQ/zFwotplCH7tl7tK7Hyb5/uBjnxk9J61epv68TPtDNmVz\nSB+dyGafczn4+8umbK7eh2x24EM2ZXNIH7I5448u5HLQx8yy2ZVcjuhFNmeYzalvEQ8AAADA9PX9\nxtAAAAAAvWAIBAAAANADhkAAAAAAPWAIBAAAANADhkAAAAAAPWAIBAAAANADhkAAAAAAPfD/A0to\nbZZfNc/3AAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x115fc0c50>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "import numpy as np\n",
    "import matplotlib.pyplot as plt\n",
    "\n",
    "\n",
    "plt.figure(figsize=(20,4))\n",
    "for index, (image, label) in enumerate(zip(train_img[0:5], train_lbl[0:5])):\n",
    "    plt.subplot(1, 5, index + 1)\n",
    "    plt.imshow(np.reshape(image, (28,28)), cmap=plt.cm.gray)\n",
    "    plt.title('Training: %i\\n' % label, fontsize = 20)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Scikit-learn 4-Step Modeling Pattern (Digits Dataset)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**Step 1.** Import the model you want to use"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "In sklearn, all machine learning models are implemented as Python classes"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 54,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "from sklearn.linear_model import LogisticRegression"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**Step 2.** Make an instance of the Model"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 56,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "# all parameters not specified are set to their defaults\n",
    "# default solver is incredibly slow thats why we change it\n",
    "logisticRegr = LogisticRegression(solver = 'lbfgs')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**Step 3.** Training the model on the data, storing the information learned from the data"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Model is learning the relationship between digits and labels"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 57,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "LogisticRegression(C=1.0, class_weight=None, dual=False, fit_intercept=True,\n",
       "          intercept_scaling=1, max_iter=100, multi_class='ovr', n_jobs=1,\n",
       "          penalty='l2', random_state=None, solver='lbfgs', tol=0.0001,\n",
       "          verbose=0, warm_start=False)"
      ]
     },
     "execution_count": 57,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "logisticRegr.fit(train_img, train_lbl)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**Step 4.** Predict the labels of new data (new images)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Uses the information the model learned during the model training process"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([ 1.])"
      ]
     },
     "execution_count": 42,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# Returns a NumPy Array\n",
    "# Predict for One Observation (image)\n",
    "logisticRegr.predict(test_img[0].reshape(1,-1))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([ 1.,  9.,  2.,  2.,  7.,  1.,  8.,  3.,  3.,  7.])"
      ]
     },
     "execution_count": 43,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# Predict for Multiple Observations (images) at Once\n",
    "logisticRegr.predict(test_img[0:10])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 44,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "# Make predictions on entire test data\n",
    "predictions = logisticRegr.predict(test_img)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Measuring Model Performance (MNIST)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "While there are other ways of measuring model performance, we are going to keep this simple and use accuracy as our metric. \n",
    "To do this are going to see how the model performs on the new data (test set)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "accuracy is defined as: \n",
    "\n",
    "(fraction of correct predictions): correct predictions / total number of data points"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0.9131\n"
     ]
    }
   ],
   "source": [
    "score = logisticRegr.score(test_img, test_lbl)\n",
    "print(score)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Display Misclassified images with Predicted Labels (MNIST)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "index = 0\n",
    "misclassifiedIndexes = []\n",
    "for label, predict in zip(test_lbl, predictions):\n",
    "    if label != predict: \n",
    "        misclassifiedIndexes.append(index)\n",
    "    index +=1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAABIEAAADxCAYAAABcW6cTAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3XuYFNW57/Hfi4CiiAFURKIQjG6TiAJyvCuoBOMteAfM\nNmDMFg/GaLwcEz0xaJKTCKLGRI1GETXZYLywg4o3EO9iRKIJ3tBt8MhFiJcoGAGBtf+oGmmaXjXd\n1dXda6a+n+eZZ5h6e1W93dO/6ZlFdS1zzgkAAAAAAACtW5tGNwAAAAAAAIDaYxIIAAAAAAAgB5gE\nAgAAAAAAyAEmgQAAAAAAAHKASSAAAAAAAIAcYBIIAAAAAAAgB+o6CWRmY83MFXwsNrO7zWynGh/3\nLjN7rKiP9yoY3z4e0zfDnr5nZq6K8aeb2TwzW2lmS83sjjLGbGpmE8xsmZl9Ymb3m1mvtD3E+2z6\nnv4s5fjTzeyYanpoZv+94v6OSjF2QdHz1ZnZu2WOHWpmf4u/P6+Y2bDKu68PcrnBPlPn0sy+bmZP\nm9lHcSanmtm/lTGOXJY/bvv4sZoXP1bvmNmtZrZ9meNbTC4lslm0z6peM+N9bBE/Z5yZ7VbG7clm\nZWO/YGYTzewDM1thZg+Y2ZfLHEs2yztuq8mmmQ00s1lxvlaZ2Vtx3jqVMZZsVjaWbJLNtPvgdbP5\n/af9nXaQbfx3ZtPHQ2WMryqbjTgT6CNJ+8Yf50vqK2mmmW1Rxx5uknRYBbdvL+kninptuDgE4yRN\nUnQ/zpJUzg+aa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uuGNVPWVl//3399bOPfdcb2348OG1aCc3yGbLc80113hr3/rWt7y1rbba\nKtXxkvL3i1/8ItU+0TyyWb6RI0d6a5dd5n/InEt3csa6detKbu/evbt3zH333eetXX/99d7a5Zdf\nXn5jqAuyCdRGNW8H6yZpqpk17ec/nXMPZtIVgGqQTSBMZBMIE9kEwkQ2gRpIPQnknHtL0h4Z9gIg\nA2QTCBPZBMJENoEwkU2gNlgiHgAAAAAAIAeYBAIAAAAAAMgBJoEAAAAAAABygEkgAAAAAACAHLC0\nSzamOphZ/Q6WY127di25ff78+d4xm2++ubd2yimneGtJS8tjY845a3QPpZDNjT34oH/xiSFDhtSt\nj9/+9rfe2p133umtPfzww97aJpts4q299NJL3lq/fv28tZaObLZ+7du399b69+9fcvsTTzzhHbNi\nxQpvrV27dt5ahw4dvLXvfOc73tptt93mrbVmZLP+dtllF29t1qxZ3lq3bt0y7yVeFWojtfj7Jen3\n3cmTJ2d+vJaObLZ+Sb8v+qxdu7YGnaAS5WSTM4EAAAAAAABygEkgAAAAAACAHGASCAAAAAAAIAeY\nBAIAAAAAAMgBJoEAAAAAAABygEkgAAAAAACAHGjb6AaQTu/evb21559/vuT2L3zhC94xp512mrfG\nMvBoyXr16uWt3X777d7afvvtl3kv7733XsntI0eO9I5JWo535cqV3lotls8FWrITTzzRW7vkkktK\nbj/qqKO8Y1555RVvbeutt/bWzjjjDG9tzpw53hpQL1OnTvXWtttuO28t7evOPvvs463tueeeJbdf\ne+21qY6VJOm+AaEz868Kvscee3hrnTt39tbOPPNMb61jx44ltx977LHeMatXr/bW2rdv762l1aNH\nD28tKe/777+/t7Zw4UJv7Q9/+EN5jQWAM4EAAAAAAABygEkgAAAAAACAHGASCAAAAAAAIAeYBAIA\nAAAAAMgBJoEAAAAAAABygEkgAAAAAACAHGCJ+AZr166dtzZ48GBvbfLkyd5ap06dSm7/2c9+5h1z\nxx13eGtAS5a0DHzSEpBpJWXp7LPPLrl92bJlqY7Vt29fb61NG+b4kT/XXXedt3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vqzjm3KP68\nTNJURacPNtLS+D2CTe8VXNaIJpxzS51za51z6yT9TnV6XMysnaIg/ME5d0+8uSGPSaleGvW41BHZ\n9CObAWQzp7mUyGYSskk2G4ls+pFNstkoweRSCi6bQeRSIpuNzmYjJoGel7SzmX3JzNpLGi5pWr2b\nMLMt4gsxycy2kDRE0rzkUTU3TdLI+N8jJf2pEU00hSB2rOrwuJiZSbpZ0qvOuSsLSnV/THy9NOJx\nqTOy6Uc2G5zNHOdSIptJyCbZbCSy6Uc2yWajBJFLKchsBpFLiWyW6qOuj4lzru4fko5QdNX2/5Z0\ncYN66C3ppfjj5Xr3IWmyotO8PlP0XtXTJHWVNFPSG5JmSOrSoD5ul/Q3SX9VFIrudejjAEWn3v1V\n0ovxxxENekx8vdT9can3B9kkmyX6CCKbec5lfP/JJtks7oNsBvBBNslmiT7IZoM/Qshl3EfDshlK\nLhN6IZsNzGbdl4gHAAAAAABA/eX9wtAAAAAAAAC5wCQQAAAAAABADjAJBAAAAAAAkANMAgEAAAAA\nAOQAk0AAAAAAAAA5wCQQAAAAAABADjAJBAAAAAAAkAP/A3bES8tF6PlsAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x116a628d0>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.figure(figsize=(20,4))\n",
    "for plotIndex, badIndex in enumerate(misclassifiedIndexes[0:5]):\n",
    "    plt.subplot(1, 5, plotIndex + 1)\n",
    "    plt.imshow(np.reshape(test_img[badIndex], (28,28)), cmap=plt.cm.gray)\n",
    "    plt.title('Predicted: {}, Actual: {}'.format(predictions[badIndex], test_lbl[badIndex]), fontsize = 15)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "<b>if this tutorial doesn't cover what you are looking for, please leave a comment on the youtube video or blog post and I will try to cover what you are interested in. </b>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "[youtube video](https://www.youtube.com/watch?v=71iXeuKFcQM)"
   ]
  }
 ],
 "metadata": {
  "anaconda-cloud": {},
  "kernelspec": {
   "display_name": "Python [conda root]",
   "language": "python",
   "name": "conda-root-py"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.13"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 1
}
